package cfca.paperless.client.servlet._4_manager._4_07_DeleteSeal;

import cfca.paperless.client.servlet.PaperlessConfig;
import cfca.paperless.client.servlet.PaperlessManagerClient;
import cfca.paperless.client.util.Base64;
import cfca.paperless.client.util.PaperlessUtil;
import cfca.paperless.client.util.StringUtil;

public class DeleteSealTest01 {
    
    public static void main(String[] args) throws Exception {
        try{
            PaperlessManagerClient clientBean = new PaperlessManagerClient(PaperlessConfig.managerUrl, 10000, 60000);// 无纸化管理接口的访问URL
            
            String revokeFlag = "1";// 吊销标识0：不吊销 1：无纸化内部在线吊销2：无纸化内部在线吊销+外部软证书删除

            StringBuilder sb = new StringBuilder();
            sb.append("<SealInfo>");
            sb.append("<SealCode>").append("yz201804457754378").append("</SealCode>");// 已经在服务端生成的、需要做删除操作的印章编码
            sb.append("<SealPassword>").append(Base64.encode("cfca1234", "utf-8")).append("</SealPassword>");// 印章密码，待删除的印章已经设置过密码时需要验证
            sb.append("</SealInfo>");
            String sealInfoXml = sb.toString();
            System.out.println(sealInfoXml);
           // 操作员编码或者机构号
            String operatorCode = PaperlessConfig.operatorCode;
            //获取上传结果
            String result = clientBean.deleteSeal(sealInfoXml,revokeFlag,operatorCode);
            String code = StringUtil.getNodeText(result, "Code");

            if ("200".equals(code)) {
                System.out.println(result);
                System.out.println("OK:deleteSeal");
            } else {
                System.out.println("NG:deleteSeal");
                // 处理结果为异常，打印出错误码和错误信息
                System.out.println(result);
            }
        }catch (Exception e) {
            e.printStackTrace();
        }
        

    }

}
